package com.hera.process.config.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import com.hera.base.dao.repository.BaseRepository;
import com.hera.process.workflow.domain.Stage;

public interface StageDao extends BaseRepository<Stage, Long>{
	@Query("select stage from Stage stage where stage.swimlane.swimlanePK.idProcess = ?1 and stage.idFigure = ?2")
	public List<Stage> findStageByProcessAndIdDiagram(Long idProcess, String idFigure);
	@Query("select stage from Stage stage where stage.swimlane.swimlanePK.idProcess = ?1")
	public List<Stage> findStageByProcessId(Long idProcess);
	
	@Query("select stage from Stage stage where stage.swimlane.swimlanePK.idProcess = ?1 and stage.idType=?2")
	public List<Stage> findStageByProcessIdandTypeId(Long idProcess,Long idType);
	
	@Query("select stageRollup.stageTo from StageRollup stageRollup where stageRollup.stageFrom.idStage = ?1")
	public Stage findNextStage(Long idStage);

}
